﻿using System.Web.UI.WebControls;
using AppCommon;
using Controller;

/// <summary>
/// Summary description for BindDatatoDDL
/// </summary>
public class BindDatatoDDL
{
	public BindDatatoDDL()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public static void BindLoaiChuyenMuc(DropDownList dropDownList)
    {
        var controller = new VYC04Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }
    public static void BindSubLoaiChuyenMuc(DropDownList dropDownList)
    {
        var controller = new VYC05Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindLoaiTour(DropDownList dropDownList)
    {
        var controller = new VYC02Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindSubLoaiTour(DropDownList dropDownList, int id)
    {
        var controller = new VYC03Controller();
        dropDownList.DataSource = controller.GetById(id);
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }
    public static void BindTourDiemDen(DropDownList dropDownList)
    {
        var controller = new VYC0301Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }
    public static void BindSubLoaiTourAll(DropDownList dropDownList)
    {
        var controller = new VYC03Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindCountry(DropDownList dropDownList)
    {
        var controller = new VYC27Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem {Text = " -- Chọn --", Value = "0"};
        dropDownList.Items.Insert(0, item);
    }

    public static void BindPhanQuyen(DropDownList dropDownList)
    {
        var controller = new VYC18Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindDiaDiem(DropDownList dropDownList)
    {
        var controller = new VYC24Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindTourDocDao(DropDownList dropDownList)
    {
        var controller = new VYC02Controller();
        var list = controller.GetByUniqueId(Common.ConvertToUnSign(Constants.TITLE_TOUR_DOCDAO));
        if (list.Count > 0)
        {
            var ctlVyc03 = new VYC03Controller();
            var listTourDd = ctlVyc03.GetByIdLoaiTour(list[0].Id);
            dropDownList.DataSource = listTourDd;    
        }
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindTourLeTet(DropDownList dropDownList)
    {
        var controller = new VYC02Controller();
        var list = controller.GetByUniqueId(Common.ConvertToUnSign(Constants.TITLE_TOUR_LETET));
        if (list.Count > 0)
        {
            var ctlVyc03 = new VYC03Controller();
            var listTourDd = ctlVyc03.GetByIdLoaiTour(list[0].Id);
            dropDownList.DataSource = listTourDd;
        }
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindNhomlienlac(DropDownList dropDownList)
    {
        var controller = new VYC15Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindTuoi(DropDownList dropDownList)
    {
        var controller = new VYC08Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindLoaiKhach(DropDownList dropDownList)
    {
        var controller = new VYC10Controller();
        dropDownList.DataSource = controller.GetAllList();
        dropDownList.DataTextField = "Ten";
        dropDownList.DataValueField = "Id";
        dropDownList.DataBind();

        var item = new ListItem { Text = " -- Chọn --", Value = "0" };
        dropDownList.Items.Insert(0, item);
    }

    public static void BindGioitinh(DropDownList dropDownList)
    {        
        var item = new ListItem { Text = " -- Chọn --", Value = "-1" };
        var item1 = new ListItem { Text = "Nữ", Value = "0" };
        var item2 = new ListItem { Text = "Nam", Value = "1" };
        dropDownList.Items.Insert(0, item2);
        dropDownList.Items.Insert(0, item1);
        dropDownList.Items.Insert(0, item);
        
    }

    public static void BindPhongdon(DropDownList dropDownList)
    {
        var item = new ListItem { Text = " -- Chọn --", Value = "-1" };
        var item1 = new ListItem { Text = "Không", Value = "0" };
        var item2 = new ListItem { Text = "Có", Value = "1" };
        dropDownList.Items.Insert(0, item2);
        dropDownList.Items.Insert(0, item1);
        dropDownList.Items.Insert(0, item);

    }
    
}